home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / ambush.c < prev    next >
C/C++ Source or Header  |  2000-04-04  |  8KB  |  251 lines

  1. /***************************************************************************
  2.  
  3. Ambush Memory Map (preliminary)
  4.  
  5. driver by Zsolt Vasvari
  6.  
  7.  
  8. Memory Mapped:
  9.  
  10. 0000-7fff   R    ROM
  11. 8000-87ff    R/W    RAM
  12. a000        R    Watchdog Reset
  13. c080-c09f    W    Scroll RAM (1 byte for each column)
  14. c100-c1ff    W   Color RAM (1 line corresponds to 4 in the video ram)
  15. c200-c3ff   W   Sprite RAM
  16. c400-c7ff   W   Video RAM
  17. c800        R   DIP Switches
  18. cc00-cc03   W   ??? (Maybe analog sound triggers?)
  19. cc04        W   Flip Screen
  20. cc05        W   Color Bank Select
  21. cc07        W   Coin Counter
  22.  
  23.  
  24. I/O Ports:
  25.  
  26. 00-01        R/W AY8910 #0 (Port A = Input Port #0)
  27. 80-81        R/W AY8910 #1 (Port A = Input Port #1)
  28.  
  29.  
  30. TODO:
  31.  
  32. - Verify Z80 and AY8910 clock speeds
  33.  
  34. ***************************************************************************/
  35.  
  36. #include "driver.h"
  37. #include "vidhrdw/generic.h"
  38.  
  39.  
  40. extern unsigned char *ambush_scrollram;
  41. extern unsigned char *ambush_colorbank;
  42.  
  43. void ambush_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  44. void ambush_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  45.  
  46.  
  47. static WRITE_HANDLER( ambush_coin_counter_w )
  48. {
  49.     coin_counter_w(0, data & 0x01);
  50.     coin_counter_w(1, data & 0x02);
  51. }
  52.  
  53.  
  54. static struct MemoryReadAddress readmem[] =
  55. {
  56.     { 0x0000, 0x7fff, MRA_ROM },
  57.     { 0x8000, 0x87ff, MRA_RAM },
  58.     { 0xa000, 0xa000, watchdog_reset_r },
  59.     { 0xc000, 0xc7ff, MRA_RAM },
  60.     { 0xc800, 0xc800, input_port_2_r },
  61.     { -1 }  /* end of table */
  62. };
  63.  
  64. static struct MemoryWriteAddress writemem[] =
  65. {
  66.     { 0x8000, 0x87ff, MWA_RAM },
  67.     { 0xc080, 0xc09f, MWA_RAM, &ambush_scrollram },
  68.     { 0xc100, 0xc1ff, MWA_RAM, &colorram },
  69.     { 0xc200, 0xc3ff, MWA_RAM, &spriteram, &spriteram_size },
  70.     { 0xc400, 0xc7ff, MWA_RAM, &videoram, &videoram_size },
  71.     { 0xcc00, 0xcc03, MWA_NOP },
  72.     { 0xcc04, 0xcc04, MWA_RAM, &flip_screen },
  73.     { 0xcc05, 0xcc05, MWA_RAM, &ambush_colorbank },
  74.     { 0xcc07, 0xcc07, ambush_coin_counter_w },
  75.     { -1 }  /* end of table */
  76. };
  77.  
  78. static struct IOReadPort readport[] =
  79. {
  80.     { 0x00, 0x00, AY8910_read_port_0_r },
  81.     { 0x80, 0x80, AY8910_read_port_1_r },
  82.     { -1 }  /* end of table */
  83. };
  84.  
  85. static struct IOWritePort writeport[] =
  86. {
  87.     { 0x00, 0x00, AY8910_control_port_0_w },
  88.     { 0x01, 0x01, AY8910_write_port_0_w },
  89.     { 0x80, 0x80, AY8910_control_port_1_w },
  90.     { 0x81, 0x81, AY8910_write_port_1_w },
  91.     { -1 }  /* end of table */
  92. };
  93.  
  94.  
  95. INPUT_PORTS_START( ambush )
  96.     PORT_START      /* IN0 */
  97.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON2 )
  98.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON1 )
  99.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  100.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  101.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_START2 )
  102.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_START1 )
  103.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
  104.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )
  105.  
  106.     PORT_START      /* IN1 */
  107.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY )
  108.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY )
  109.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY )
  110.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  111.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_JOYSTICK_UP    | IPF_8WAY | IPF_COCKTAIL )
  112.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN  | IPF_8WAY | IPF_COCKTAIL )
  113.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT  | IPF_8WAY | IPF_COCKTAIL )
  114.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  115.  
  116.     PORT_START      /* DSW */
  117.     PORT_DIPNAME( 0x03, 0x00, DEF_STR( Lives ) )
  118.     PORT_DIPSETTING(    0x00, "3" )
  119.     PORT_DIPSETTING(    0x01, "4" )
  120.     PORT_DIPNAME( 0x1c, 0x00, DEF_STR( Coinage ) )
  121.     PORT_DIPSETTING(    0x14, DEF_STR( 3C_1C ) )
  122.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  123.     PORT_DIPSETTING(    0x00, DEF_STR( 1C_1C ) )
  124.     PORT_DIPSETTING(    0x04, DEF_STR( 1C_2C ) )
  125.     PORT_DIPSETTING(    0x18, DEF_STR( 2C_5C ) )
  126.     PORT_DIPSETTING(    0x08, DEF_STR( 1C_3C ) )
  127.     PORT_DIPSETTING(    0x0c, DEF_STR( 1C_4C ) )
  128.     PORT_DIPSETTING(    0x1c, "Service Mode/Free Play" )
  129.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Unknown ) )  /* used */
  130.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  131.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  132.     PORT_DIPNAME( 0x40, 0x40, DEF_STR( Bonus_Life ) )
  133.     PORT_DIPSETTING(    0x40, "80000" )
  134.     PORT_DIPSETTING(    0x00, "120000" )
  135.     PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) )
  136.     PORT_DIPSETTING(    0x80, DEF_STR( Upright ) )
  137.     PORT_DIPSETTING(    0x00, DEF_STR( Cocktail ) )
  138. INPUT_PORTS_END
  139.  
  140.  
  141. static struct GfxLayout charlayout =
  142. {
  143.     8,8,    /* 8*8 chars */
  144.     1024,   /* 2048 characters */
  145.     2,      /* 2 bits per pixel */
  146.     { 0, 0x2000*8 },  /* The bitplanes are seperate */
  147.     { 0, 1, 2, 3, 4, 5, 6, 7},
  148.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8},
  149.     8*8     /* every char takes 8 consecutive bytes */
  150. };
  151.  
  152. static struct GfxLayout spritelayout =
  153. {
  154.     16,16,  /* 8*8 chars */
  155.     256,    /* 2048 characters */
  156.     2,      /* 2 bits per pixel */
  157.     { 0, 0x2000*8 },  /* The bitplanes are seperate */
  158.     {     0,     1,     2,     3,     4,     5,     6,     7,
  159.       8*8+0, 8*8+1, 8*8+2, 8*8+3, 8*8+4, 8*8+5, 8*8+6, 8*8+7 },
  160.     {  0*8,  1*8,  2*8,  3*8,  4*8,  5*8,  6*8,  7*8,
  161.       16*8, 17*8, 18*8, 19*8, 20*8, 21*8, 22*8, 23*8 },
  162.     32*8     /* every char takes 32 consecutive bytes */
  163. };
  164.  
  165. static struct GfxDecodeInfo gfxdecodeinfo[] =
  166. {
  167.     { REGION_GFX1, 0x0000, &charlayout,   0, 128 },    /* I'm only using the first 64 colors */
  168.     { REGION_GFX1, 0x0000, &spritelayout, 0, 128 },
  169.     { -1 } /* end of array */
  170. };
  171.  
  172.  
  173. static struct AY8910interface ay8910_interface =
  174. {
  175.     2,    /* 2 chips */
  176.     1500000,    /* 1.5 MHz ? */
  177.     { 25, 25 },
  178.     { input_port_0_r, input_port_1_r },
  179.     { 0, 0 },
  180.     { 0, 0 },
  181.     { 0, 0 }
  182. };
  183.  
  184.  
  185. static struct MachineDriver machine_driver_ambush =
  186. {
  187.     /* basic machine hardware */
  188.     {
  189.         {
  190.             CPU_Z80,
  191.             4000000,        /* 4.00 MHz??? */
  192.             readmem,writemem,readport,writeport,
  193.             interrupt,1
  194.         }
  195.     },
  196.     60, DEFAULT_REAL_60HZ_VBLANK_DURATION,  /* frames per second, vblank duration */
  197.     1,      /* single CPU, no need for interleaving */
  198.     0,
  199.  
  200.     /* video hardware */
  201.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-3 },  /* The -3 makes the cocktail mode perfect */
  202.     gfxdecodeinfo,
  203.     512, 512,
  204.     ambush_vh_convert_color_prom,
  205.  
  206.     VIDEO_TYPE_RASTER,
  207.     0,
  208.     generic_vh_start,
  209.     generic_vh_stop,
  210.     ambush_vh_screenrefresh,
  211.  
  212.     /* sound hardware */
  213.     0,0,0,0,
  214.     {
  215.         {
  216.             SOUND_AY8910,
  217.             &ay8910_interface
  218.         }
  219.     }
  220. };
  221.  
  222.  
  223. /***************************************************************************
  224.  
  225.   Game driver(s)
  226.  
  227. ***************************************************************************/
  228.  
  229. ROM_START( ambush )
  230.     ROM_REGION( 0x10000, REGION_CPU1 )       /* 64k for code */
  231.     ROM_LOAD( "ambush.h7",    0x0000, 0x2000, 0xce306563 )
  232.     ROM_LOAD( "ambush.g7",    0x2000, 0x2000, 0x90291409 )
  233.     ROM_LOAD( "ambush.f7",    0x4000, 0x2000, 0xd023ca29 )
  234.     ROM_LOAD( "ambush.e7",    0x6000, 0x2000, 0x6cc2d3ee )
  235.  
  236.     ROM_REGION( 0x4000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  237.     ROM_LOAD( "ambush.n4",    0x0000, 0x2000, 0xecc0dc85 )
  238.     ROM_LOAD( "ambush.m4",    0x2000, 0x2000, 0xe86ca98a )
  239.  
  240.     ROM_REGION( 0x0400, REGION_PROMS )
  241.     ROM_LOAD( "a.bpr",        0x0000, 0x0100, 0x5f27f511 )  /* color PROMs */
  242.     ROM_LOAD( "b.bpr",        0x0100, 0x0100, 0x1b03fd3b )    /* How is this selected, */
  243.                                                             /* or is it even a color PROM? */
  244.     ROM_LOAD( "13.bpr",          0x0200, 0x0100, 0x547e970f )  /* I'm not sure what these do. */
  245.     ROM_LOAD( "14.bpr",          0x0300, 0x0100, 0x622a8ce7 )  /* They don't look like color PROMs */
  246. ROM_END
  247.  
  248.  
  249.  
  250. GAME( 1983, ambush, 0, ambush, ambush, 0, ROT0, "Nippon Amuse Co-Ltd", "Ambush" )
  251.